home *** CD-ROM | disk | FTP | other *** search
/ Internet Tools (InfoMagic) / Internet Tools.iso / dos_win / winsock / maillist / 94-05.Z / 94-05 / 000000_junodj@css583.gordon.army.mil_Sun May 1 06:37:42 1994.msg next >
Internet Message Format  |  1994-05-31  |  2KB

  1. Received: from SLIP1.CSS.GORDON.ARMY.MIL ([147.51.202.2]) by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
  2.           id AA20815; Sun, 1 May 1994 13:04:58 -0400
  3. Date:     Sun,  1 May 94 11:37:42 EST
  4. Message-Id: <9405011137.AA18296@SLIP1.CSS.GORDON.ARMY.MIL>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=us-ascii
  7. From: "John A. Junod" <junodj@css583.gordon.army.mil>
  8. Reply-To: <junodj@css583.gordon.army.mil>
  9. Sender: <junodj@SLIP1.CSS.GORDON.ARMY.MIL>
  10. To: winsock@sunsite.unc.edu
  11. Subject:  problem with MS VXD TCP-IP eating file handles
  12. X-Mailer: <IMAIL v94.04.28>
  13.  
  14. Seems to be a little problem with the MS resolver routines in 
  15. the following case.
  16.  
  17.  
  18.   struct hostent FAR *pHostEntry;
  19.   SOCKADDR_IN sa;
  20.  
  21.   if((pHostEntry=gethostbyname(hostname))!=NULL)
  22.   {
  23.     // do something...
  24.   } else if((sa.sin_addr.s_addr=inet_addr(hostname))!=INADDR_NONE)
  25.     // do something else..
  26.  
  27. When the host name is a string that doesn't get resolved in the
  28. first "gethostbyname()" call, it will leave a file handle open
  29. when the inet_addr is called.  Of course, you only get 20 file
  30. handles by default in a Windows program, so your program can
  31. run out of file handles rather quickly.   (reported to MS)
  32.  
  33. Looks like you have to determine if your "hostname" is a valid
  34. IP address BEFORE you call inet_addr!
  35.  
  36. John
  37.  
  38. ---------------------------------------------------------------
  39. | John A. Junod         |      72321.366@compuserve.com       |
  40. | 267 Hillwood Street   | -->  junodj@css583.gordon.army.mil  |
  41. | Martinez, GA, 30907   |      zj8549@trotter.usma.edu        |
  42. | (706)-860-2671        |                                     |
  43. ---------------------(sent by IMAIL)---------------------------